package com.zx.platform.utils;

import java.util.Date;
import java.util.Random;
import java.util.UUID;

import org.apache.http.impl.cookie.DateUtils;

/**
 * Key自动生成工具类 add by wenjw 2015.5.13
 */
public class KeyUtils {
	/**
	 * 
	 * 生成UUID
	 * 
	 * @param date
	 * @param tianshu
	 * @return
	 */
	public static String getUUID() {
		return UUID.randomUUID().toString().replace("-", "");
	}
	/**
	 * 精确到毫秒+随机三位数生成20位的ID
	 * @return
	 */
	public static String getDateStrAndRandom() {
		Random rnd = new Random();
		int num = 100 + rnd.nextInt(900);
		String dateStr = DateUtils.formatDate(new Date(), "yyyyMMddHHmmssSSS");
		return dateStr + num;
	}

}
